package org.baiyun.project.cal.web.service;


public class CalServiceImpl implements ICalService{

    @Override
    public int doCompute(int a, int b, char op){

        int r;

        switch (op) {
            case '+':
                r = a + b;
                break;
            case '-':
                r = a - b;
                break;
            case '*':
                r = a * b;
                break;
            case '/':
                r = a / b;
                break;
            default:
                r = -1;
        }

        return r;

    }
}
